﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DECOR.DL.DALC;

namespace DECOR.DL.DALCF
{
    public enum ConnectionType { SQLServer, Oracle, SAP, NC03 }
    
    public class DaoFactory
    {
        public static ConnectionType ConnType = ConnectionType.NC03;
        public static ConnectionType ConnTypeUsuarios = ConnectionType.NC03;
        //public static ConnectionType ConnType = ConnectionType.SAP;
        //public static ConnectionType ConnTypeUsuarios = ConnectionType.SAP;
        public static string pConnId = string.Empty;

        public static IUsuarioDALC UsuarioDALC
        {
            get
            {
                IUsuarioDALC objRet = null;
                switch (ConnTypeUsuarios)
                {
                    case ConnectionType.SQLServer:
                        objRet = new DECOR.DL.DALC.MSSQL.UsuarioDALC();
                        break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.UsuarioDALC.Instance();                        
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.UsuarioDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }
        public static IUsuarioSAPDALC UsuarioSAPDALC
        {
            get
            {
                return new DECOR.DL.DALC.MSSQL.UsuarioSAPDALC();
            }
        }
        public static ISistemaSAPDALC SistemaSAPDALC
        {
            get
            {
                return new DECOR.DL.DALC.MSSQL.SistemaSAPDALC();
            }
        }

        public static IPartidaDALC PartidaDALC
        {
            get
            {
                IPartidaDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                        //break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.PartidaDALC.Instance();
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IBloqueoDALC BloqueoDALC
        {
            get
            {
                IBloqueoDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                        //break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.BloqueoDALC.Instance();
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static ICondicionDALC CondicionDALC
        {
            get
            {
                ICondicionDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                        //break;
                    case ConnectionType.SAP:
                        objRet =  DECOR.DL.DALC.SAPC.CondicionDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.CondicionDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IPedidoDALC PedidoDALC
        {
            get
            {
                IPedidoDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                        //break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.PedidoDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.PedidoDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IPersonaDALC PersonaDALC
        {
            get
            {
                IPersonaDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                    //break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.PersonaDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.PersonaDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static ICondicionPagoDALC CondicionPagoDALC
        {
            get
            {
                ICondicionPagoDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                    //break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.CondicionPagoDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.CondicionPagoDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IJerarquiaDALC JerarquiaDALC
        {
            get
            {
                IJerarquiaDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                    //break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.JerarquiaDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.JerarquiaDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IStockDALC StockDALC
        {
            get
            {
                IStockDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                    //break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.StockDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.StockDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static ILoteDALC LoteDALC
        {
            get
            {
                ILoteDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                    //break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.LoteDALC.Instance();
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IAlmacenDALC AlmacenDALC
        {
            get
            {
                IAlmacenDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                    //break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.AlmacenDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.AlmacenDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static ICentroDALC CentroDALC
        {
            get
            {
                ICentroDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                    //break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.CentroDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.CentroDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IClienteDALC ClienteDALC
        {
            get
            {
                IClienteDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                    //break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.ClienteDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.ClienteDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IOficinaDALC OficinaDALC
        {
            get
            {
                IOficinaDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                    //break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.OficinaDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.OficinaDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IGrupoVendedoresDALC GrupoVendedoresDALC
        {
            get
            {
                IGrupoVendedoresDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                    //break;
                    case ConnectionType.SAP:
                        objRet =  DECOR.DL.DALC.SAPC.GrupoVendedoresDALC.Instance();
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static ITipoDocumentoDALC TipoDocumentoDALC
        {
            get
            {
                ITipoDocumentoDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        throw new NotImplementedException("No se ha implementado la conexión con MSSQL Server.");
                    //break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.TipoDocumentoDALC.Instance();
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IMaterialDALC MaterialDALC
        {
            get
            {
                IMaterialDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        //objRet = new DECOR.DL.DALC.MSSQL.MaterialDALC();
                        break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.MaterialDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.MaterialDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IParametroDALC ParametroDALC
        {
            get
            {
                IParametroDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        //objRet = new DECOR.DL.DALC.MSSQL.ParametroDALC();
                        break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.ParametroDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.ParametroDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }


        public static IReclamoDALC ReclamoDALC
        {
            get
            {
                IReclamoDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        //objRet = new DECOR.DL.DALC.MSSQL.ParametroDALC();
                        break;
                    case ConnectionType.SAP:
                        objRet = DECOR.DL.DALC.SAPC.ReclamoDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.ReclamoDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }

        public static IUbigeoDALC UbigeoDALC
        {
            get
            {
                IUbigeoDALC objRet = null;
                switch (ConnType)
                {
                    case ConnectionType.SQLServer:
                        //objRet = new DECOR.DL.DALC.MSSQL.ParametroDALC();
                        break;
                    case ConnectionType.SAP:
                        //Ubigeo solo creado para NCO3
                        //objRet = DECOR.DL.DALC.SAPC.IUbigeoDALC.Instance();
                        break;
                    case ConnectionType.NC03:
                        objRet = DECOR.DL.DALC.NC03.UbigeoDALC.Instance(pConnId);
                        break;
                    default:
                        throw new Exception("Unknown Connection Type");
                }
                return objRet;
            }
        }
    }
}
